import { createRouter, createWebHistory } from "vue-router";

// 路由规则
const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        name: 'home',
        component: () => import('@/views/HomeView.vue')
    },
    {
        path: '/note',
        name: 'note',
        component: () => import('@/views/note/IndexView.vue'),
        children: [
            {
                path: 'edit/:id',
                props: true,
                name: 'edit-note',
                component: () => import('@/views/note/EditNoteView.vue'),
            }
        ]
    },
    {
        path: '/thing',
        name: 'thing',
        component: () => import('@/views/thing/IndexView.vue')
    },
    {
        path: '/star',
        name: 'star',
        component: () => import('@/views/star/IndexView.vue')
    },
    {
        path: '/shop',
        name: 'shop',
        component: () => import('@/views/shop/IndexView.vue')
    },
    {
        path: '/rubbish-bin',
        name: 'rubbish-bin',
        component: () => import('@/views/rubbish_bin/IndexView.vue')
    },
    {
        path: '/security-center',
        name: 'security-center',
        component: () => import('@/views/user/SecurityCenterView.vue')
    },
]

// 创建路由
export const router = createRouter({
    history: createWebHistory(), // html5 模式
    routes
})